using System.Collections;
using System.Collections.Generic;
using Unity.Mathematics;
using UnityEngine;
using Random = UnityEngine.Random;

public class rokect : MonoBehaviour
{
    // Start is called before the first frame update
    public GameObject explosion;
    AudioSource boommusic;
    void Start()
    {
        Destroy(gameObject, 2);
        boommusic = GetComponent < AudioSource>();
    }

    // Update is called once per frame
    void Update()
    {
        
    }
    public void OnTriggerEnter2D(Collider2D collision)
    {
        if(explosion != null)
        {
            if (collision.tag != "Player")
            {
                boommusic.Play();
                Quaternion rotation = Quaternion.Euler(0, 0, Random.Range(30, 180));
                Instantiate(explosion, transform.position, rotation);
                Destroy(gameObject);
            }



        }
    }
}
